<style lang="less">
  .order-select-dialog-sty {
    /*.el-row {*/
    /*margin-bottom: 20px;*/
    /*}*/

    .el-col {
      border-radius: 4px;
    }

    .bg-purple-dark {
      background: #ffffff;
    }

    .grid-content {
      border-radius: 4px;
      min-height: 36px;
    }

    .el-form-item {
      margin: 0px 20px 15px 20px;
    }

    .f-bs1 {
      border: 1px solid #dfe6ec;
    }

    .el-collapse {
      border: 0px;
      .el-collapse-item {
        border: 1px solid #dfe6ec;
        margin-bottom: 10px;
        .el-collapse-item__header {
          font-weight: bold;
          .el-collapse-item__header__arrow {
            display: none;
          }
        }
        .el-collapse-item__content {
          padding-bottom: 0px;
        }
        .el-collapse-item__wrap {
          border-bottom: 0px;
          .el-collapse-item__content {
            padding: 0px 0px;
          }
        }
      }
      .ecl-um-sy {
        .el-collapse-item__wrap {
          height: 48px;
        }
      }
      .eci-time-sty {
        .el-collapse-item__wrap {
          height: 100px;
          .el-collapse-item__content {
            height: 100px;
          }
        }
      }
    }

    label {
      width: 100px;
    }

    .el-form-item[data-v-7da61f17] {
      margin: 0 0 0 0
    }

    .f-mt10 {
      margin-top: 10px;
    }

    .f-ml20 {
      margin-left: 20px;
    }

    .f-mr20 {
      margin-right: 20px;
    }

    .f-mb10 {
      margin-bottom: 10px;
    }

    .f-tar {
      text-align: right;
    }

    .f-h30 {
      height: 30px;
    }

    .f-c-red {
      color: red;
    }

    .el-radio-group {
      width: 60%;
    }

    .el-radio-invoice {
      margin-right: 30px;
    }

    .f-color {
      color: #25baaf;
    }

    .el-textarea {
      width: 86%;
    }

    .f-mb {
      margin-bottom: 0;
    }

    .f-fr {
      float: right;
    }

    .f-fl {
      float: left;
    }

    .f-lh38 {
      line-height: 38px;
    }

    .el-select {
      width: 100%;
    }

    .f-w233 {
      width: 100%;
    }

    .el-form-item__label {
      width: 150px;
    }

    .el-date-editor.el-input {
      width: 100%;
    }

    li {
      list-style-type: none;
    }

    .color-c8c8c8 {
      color: #c8c8c8;
    }

    .f-mt {
      margin-top: 0;
    }
    .el-collapse-item__header {
      height: 40px;
      line-height: 40px;
    }

    .el-form-item {
      margin: 0px 0px 15px 20px;
    }
    .el-col-4 {
      width: 18%;
    }
    .efi-cargo-sty {
      .el-form-item__content {
        line-height: 0px;
        margin-top: 3px;
      }
    }
    .el-input {
      height: 22px;
    }
    .el-input .el-input__inner {
      height: 22px;
    }
    .el-input__icon {
      margin-top: 7px;
    }
    .el-form-item__error {
      padding-top: 23px;
      top: 0;
    }
    .f-bs1 {
      border: 1px solid #dfe6ec;
    }

    .f-bsr1 {
      border-right: 1px solid #dfe6ec;
      border-radius: 0;
    }

    .f-bl1 {
      border-left: 1px solid #dfe6ec;
    }

    .f-bsb1 {
      border-bottom: 1px solid #dfe6ec;
      border-right: 1px solid #dfe6ec;
      border-left: 1px solid #dfe6ec;
    }

    .f-bcc {
      background-color: #bedbf7;
    }

    .f-tc {
      text-align: center;
      color: black;
    }
    .excellent-route-sty{
      color: white;  background-color:#66B1FF;width: 35px;display: inline-block;margin-left: 5px;text-align: center;line-height:18px
    }
  }
</style>

<template>
  <div class="order-select-dialog-sty">
    <el-row>
      <el-col :span="24">
        <div class="f-bs1 grid-content bg-purple-dark">
          <div class="f-fl f-lh38 f-ml20">
            订单编号：
            <label>{{orderSelectForm.orderNumber}}&nbsp;&nbsp;</label>
            <label v-if="orderSelectForm.orderSource === 101004001"
                   style="color: #075eee;">[Android下单]</label>
            <label v-if="orderSelectForm.orderSource === 101004002" style="color: #075eee;">[IOS下单]</label>
            <label v-if="orderSelectForm.orderSource === 101004003" style="color: #075eee;">[微信下单]</label>
            <label v-if="orderSelectForm.orderSource === 101004004" style="color: #075eee;">[PC下单]</label>
            <label v-if="orderSelectForm.orderSource === 101004005" style="color: #075eee;">[接口下单]</label>
            <label style="color: #075eee;">[{{orderSelectForm.orderStatusName}}]</label>
          </div>
          <div v-if="orderSelectForm.excellentRouteServiceDetailNames" class="f-fl f-ml20">
            <div v-for="(item,index) in (orderSelectForm.excellentRouteServiceDetailNames.split(','))" :key="index" class="excellent-route-sty">
              {{item}}
            </div>
          </div>
          <div class="f-fr f-lh38 f-mr20">
            <label style="color: #075eee;"
                   v-if="orderSelectForm.orderSource !== 101004001&&orderSelectForm.orderSource !== 101004002&&orderSelectForm.orderSource !== 101004003&&orderSelectForm.createUserName != null">
              [{{orderSelectForm.createUserName}}]&nbsp;&nbsp;</label>
            <label style="color: #075eee;"
                   v-if="orderSelectForm.orderSource !== 101004001&&orderSelectForm.orderSource !== 101004002&&orderSelectForm.orderSource !== 101004003">[{{orderSelectForm.organizationName}}]&nbsp;&nbsp;</label>
            <label>{{orderSelectForm.createDate}}&nbsp;&nbsp;</label>
          </div>
        </div>
      </el-col>
    </el-row>
    <el-form ref="orderSelectForm" label-position="right" label-width="100px" :model="orderSelectForm">
      <el-collapse v-model="activeNames">
        <el-collapse-item title="客户" name="1" class="ecl-um-sy">
          <el-row>
            <el-col :span="4">
              <el-form-item label="客户名称">
                <el-input :disabled="true" v-model="orderSelectForm.memberUserName"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="货运单号" prop="freightNumber">
                <el-input :disabled="true" v-model="orderSelectForm.freightNumber"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="运单号" prop="transportationNumber">
                <el-input :disabled="true" v-model="orderSelectForm.transportationNumber"
                          placeholder="请输入运单号"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-collapse-item>
        <el-collapse-item title="发货地址" name="2">
          <el-row>
            <el-col :span="4">
              <el-form-item label="发货人" prop="shipmentsContactName">
                <el-input :disabled="true" v-model="orderSelectForm.shipmentsContactName"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="手机号码" prop="shipmentsContactPhone">
                <el-input :disabled="true" v-model="orderSelectForm.shipmentsContactPhone"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="固定电话" prop="shipmentTelephone">
                <el-input :disabled="true" v-model="orderSelectForm.shipmentsTelephone"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="所在地" prop="shipmentAddress">
                <el-input :disabled="true" style="width:115%;"
                          :value="orderSelectForm.shipmentsProvince+orderSelectForm.shipmentsCity+orderSelectForm.shipmentsCounty">
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="详细地址" prop="shipmentsStreet">
                <el-input :disabled="true" style="width:115%;"
                          :value="orderSelectForm.shipmentsTown+orderSelectForm.shipmentsStreet"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-collapse-item>
        <el-collapse-item title="收货地址" name="3" class="ecl-um-sy">
          <el-row>
            <el-col :span="4">
              <el-form-item label="收货人" prop="sendContactName">
                <el-input :disabled="true" v-model="orderSelectForm.sendContactName"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="手机号码" prop="sendContactPhone">
                <el-input :disabled="true" v-model="orderSelectForm.sendContactPhone"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="固定电话" prop="sendTelephone">
                <el-input :disabled="true" v-model="orderSelectForm.sendTelephone"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="所在地" prop="sendAddress">
                <el-input :disabled="true" style="width:115%;"
                          :value="orderSelectForm.sendProvince+orderSelectForm.sendCity+orderSelectForm.sendCounty"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="详细地址" prop="sendStreet">
                <el-input :disabled="true" style="width:115%;"
                          :value="orderSelectForm.sendTown+orderSelectForm.sendStreet"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-collapse-item>
        <el-collapse-item title="计划时间" name="4" class="eci-time-sty">
          <el-row>
            <el-col :span="4">
              <el-form-item class="f-mb" label="发货日期" prop="shipmentsDate">
                <div class="block f-h30">
                  <el-input :disabled="true" v-model="orderSelectForm.shipmentsDate"></el-input>
                </div>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="提货方式" prop="extractType">
                <el-input :disabled="true" v-model="orderSelectForm.extractTypeName"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4" v-if="orderSelectForm.extractType===105002001">
              <el-form-item class="f-mb" label="计划提货日期"
                            prop="extractDate">
                <div class="block f-h30">
                  <el-input :disabled="true" v-model="orderSelectForm.extractDate"></el-input>
                </div>
              </el-form-item>
            </el-col>
            <el-col :span="4" v-if="orderSelectForm.extractType===105002001">
              <el-form-item label="计划提货时间" prop="extractTime">
                <el-input :disabled="true" v-model="orderSelectForm.extractTime"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4" v-if="orderSelectForm.extractType===105002002">
              <el-form-item label="提货网点">
                <el-input :disabled="true"
                          :value="(orderSelectForm.startNetWorkName==null)?'':orderSelectForm.startNetWorkName +'-'+ (orderSelectForm.startNetWorkAddressNames==null?'':orderSelectForm.startNetWorkAddressNames)"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="4">
              <el-form-item label="">
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="送货方式">
                <el-input :disabled="true" v-model="orderSelectForm.sendTypeName"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4" v-if="orderSelectForm.sendType===105001001">
              <el-form-item style="margin-bottom: 0px" label="计划送货时间"
                            prop="sendTime">
                <div class="block f-h30">
                  <el-input :disabled="true" v-model="orderSelectForm.sendTime"></el-input>
                </div>
              </el-form-item>
            </el-col>
            <el-col :span="4" v-if="orderSelectForm.sendType===105001002">
              <el-form-item label="送货网点">
                <el-input :disabled="true"
                          :value="(orderSelectForm.endNetWorkName==null?'':orderSelectForm.endNetWorkName)+'-'+(orderSelectForm.endNetWorkAddressNames==null?'':orderSelectForm.endNetWorkAddressNames)"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-collapse-item>
        <el-collapse-item title="货物信息" name="5" class="eci-time-sty">
          <el-row style="margin-bottom: 0px">
            <el-col :span="4">
              <el-form-item label="货物品名" prop="cargoId">
                <el-input :disabled="true" v-if="orderSelectForm.orderCargos.length>0"
                          v-model="orderSelectForm.orderCargos[0].cargoName"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="货物类型" prop="cargoTypeName">
                <el-input :disabled="true" v-if="orderSelectForm.orderCargos.length>0"
                          v-model="orderSelectForm.orderCargos[0].cargoTypeName"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="货物包装" prop="packType">
                <el-input :disabled="true" v-if="orderSelectForm.orderCargos.length>0"
                          v-model="orderSelectForm.orderCargos[0].packTypeName"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="货物备注" prop="remark">
                <el-input autosize :disabled="true" v-if="orderSelectForm.orderCargos.length>0" type="textarea"
                          v-model="orderSelectForm.orderCargos[0].remark"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row style="margin-bottom: 0px">
            <el-col :span="4">
              <el-form-item label="重量（吨）" prop="weight">
                <el-input :disabled="true" v-if="orderSelectForm.orderCargos.length>0"
                          v-model="orderSelectForm.orderCargos[0].weight"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="体积（方）" prop="volume">
                <el-input :disabled="true" v-if="orderSelectForm.orderCargos.length>0" type="number"
                          step="0.01"
                          v-model.number="orderSelectForm.orderCargos[0].volume"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="件数" prop="amount">
                <el-input :disabled="true" v-if="orderSelectForm.orderCargos.length>0" type="number"
                          v-model.number="orderSelectForm.orderCargos[0].amount"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-collapse-item>
        <el-collapse-item title="服务" name="6" class="ecl-um-sy">
          <template slot="title" class="ecl-um-sy">
            <div>
              <el-col :span="1">增值服务</el-col>
              <el-col :span="2">
                <el-form-item label="等通知放货" label-width="100px" style="margin-bottom: 0px">
                  <el-checkbox :disabled="true" v-model="noticeDelivery"></el-checkbox>
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-tooltip placement="top">
                  <div slot="content">发货人委托平台把货物发送到目的地，货物到达目的地之后，平台必须先收到发货人的通知，方可将货物移交(送达)给收货人。
                    发货人需在3天内确认放货，若超过3天未通知放货，平台将按货量和天数，收取一定的仓储费。
                  </div>
                  <el-button type="text"><i class="f-color fa fa-info-circle" aria-hidden="true"></i></el-button>
                </el-tooltip>
              </el-col>
            </div>
          </template>
          <el-row class="f-mb">
          </el-row>
          <el-row>
            <el-col :span="4">
              <el-form-item label="保价声明" prop="">
                <el-input v-if="addBJ" :disabled="true">
                </el-input>
                <div v-for="(addValue,index) in orderSelectForm.addValues" :key="index">
                  <el-input v-if="addValue.dictValue === 101002001" :disabled="true"
                            v-model="addValue.value">
                  </el-input>
                </div>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="代收金额">
                <el-input v-if="addDS" :disabled="true">
                </el-input>
                <div v-for="(addValue,index) in orderSelectForm.addValues" :key="index">
                  <el-input v-if="addValue.dictValue === 101002002" :disabled="true"
                            v-model="addValue.value">
                  </el-input>
                </div>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="回单类型" prop="receiptType">
                <el-input v-if="addHD" :disabled="true"></el-input>
                <div v-for="(addValue,index) in orderSelectForm.addValues" :key="index">
                  <el-input v-if="addValue.dictValue === 101002003" :disabled="true"
                            v-model="addValue.value"></el-input>
                  <el-input v-if="addValue.dictValue === 101002004" :disabled="true"
                            v-model="addValue.value"></el-input>
                </div>
              </el-form-item>
            </el-col>

            <el-col :span="4">
              <el-form-item label="发票类型" prop="invoiceType">
                <el-input v-if="addFP" :disabled="true"></el-input>
                <div v-for="(addValue,index) in orderSelectForm.addValues" :key="index">
                  <el-input v-if="addValue.dictValue === 101002005" :disabled="true"
                            v-model="addValue.value"></el-input>
                  <el-input v-if="addValue.dictValue === 101002006" :disabled="true"
                            v-model="addValue.value"></el-input>
                  <el-input v-if="addValue.dictValue === 101002007" :disabled="true"
                            v-model="addValue.value"></el-input>
                </div>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="发票抬头">
                <el-input :disabled="true" v-model="TXtitle"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row class="f-mb">
            <el-col :span="10">
              <label class="f-ml20">
                <el-popover
                  ref="popoverInvoice"
                  placement="top-start"
                  width="200"
                  trigger="hover"
                  content="普通发票税率 3%">
                </el-popover>
                <label v-popover:popoverInvoice><i class="f-color fa fa-info-circle"
                                                   aria-hidden="true"></i></label>
                发 &nbsp; &nbsp; 票
              </label>
            </el-col>
          </el-row>
        </el-collapse-item>
        <el-collapse-item title="付款方式" name="7" property="paymentType">
          <el-row class="f-ml10">
            <div>{{orderSelectForm.paymentTypeName}}</div>
          </el-row>
        </el-collapse-item>
        <el-collapse-item title="运输产品" name="8" property="agingId">
          <el-row class="f-ml10">
            <div>
              {{orderSelectForm.agingName}}
              <label class="f-ml20 f-color"
                     v-if="orderSelectForm.agingModel !=null">预计{{orderSelectForm.agingModel.ageingScope}}到达，起步运费{{orderSelectForm.agingModel.startToll}}</label>
            </div>
          </el-row>
        </el-collapse-item>
        <el-collapse-item title="订单备注" name="9">
          <el-row>
            <el-col :span="10">
              <el-form-item label="订单备注" prop="remark">
                <el-input :disabled="true" type="textarea" style="margin-top: 3px" v-model="orderSelectForm.remark"
                          placeholder="请输入订单备注"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-collapse-item>
        <el-collapse-item title="费用详情" name="10">
          <el-row style="width: 100%;margin: auto" class="f-bs1">
            <el-col :span="6" class="f-bsr1 f-tc f-bcc">
              <div class="grid-content">短途提货费
                <label class="grid-content f-text-red f-fr" v-html="duthf"></label>
              </div>
            </el-col>
            <el-col :span="5" class="f-bsr1 f-tc f-bl1 f-bcc">
              <div class="grid-content">保价运费
                <label class="grid-content f-text-red f-fr" v-html="bjyf"></label>
              </div>
            </el-col>
            <el-col :span="7" class="f-bsr1 f-tc f-bcc">
              <div class="grid-content">干线运费
                <label class="f-text-red" style="width: auto" v-html="gxyf">
                </label>
              </div>
            </el-col>
            <el-col :span="6" class="f-bsr1 f-tc f-bl1 f-bcc">
              <div class="grid-content">代收货款费
                <label class="grid-content f-text-red f-fr" v-html="dshkf"></label>
              </div>
            </el-col>
          </el-row>
          <el-row style="width: 100%;margin: auto" class="f-bsb1">
            <el-col :span="6" class="f-bsr1 f-tc f-bcc">
              <div class="grid-content">短途送货费
                <label class="grid-content f-text-red f-fr" v-html="dtshf"></label>
              </div>
            </el-col>
            <el-col :span="6" class="f-bsr1 f-tc f-bcc" v-if="orderSelectForm.agingDictEntityId===112006003">
              <div class="grid-content">信息费
                <label v-if="orderSelectForm.agingDictEntityId===112006003" class="grid-content f-text-red f-fr"
                       v-html="xxf"></label>
              </div>
            </el-col>
            <el-col :span="5" class="f-bsr1 f-tc f-bl1 f-bcc">
              <div class="grid-content">回单费
                <label class="grid-content f-text-red f-fr" v-html="hdf"></label>
              </div>
            </el-col>
            <el-col :span="7" class="f-bsr1 f-tc f-bl1 f-bcc">
              <div class="grid-content">发票费
                <label class="grid-content f-text-red f-fr" v-html="fpf"></label>
              </div>
            </el-col>
          </el-row>
        </el-collapse-item>
      </el-collapse>
      <div class="f-tar f-mt10 f-mb10">
        <li class="f-mt10">订单金额：{{orderSelectForm.orderPrice}} 元
        </li>
      </div>
      <el-collapse>
        <el-collapse-item title="订单图片">
          <img v-for="(image,index) in orderSelectForm.orderImageUrls" width="60%" v-bind:src="image.cargosUrl" :key="index">
        </el-collapse-item>
      </el-collapse>
    </el-form>
  </div>
</template>
<script>
import { getOrder } from '../../api/order/order.js';
import { searchInvoiceManageByFilters } from '../../api/meb-user/TaxsheetTitle.js';

export default {

  data () {
    return {
      token: this.$store.state.token,
      activeNames: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'],
      addBJ: true,
      addDS: true,
      addHD: true,
      addFP: true,
      addBJValue: '',
      addDSValue: '',
      addValues: [
        {
          dictValue: '101002001', // 保价声明
          value: '',
          remark: ''
        },
        {
          dictValue: '101002002', // 货代金额
          value: '',
          remark: ''
        },
        {
          dictValue: '', // 回单类型
          value: '',
          remark: ''
        },
        {
          dictValue: '', // 发票类型
          value: '',
          valueMessage: '',
          remark: ''
        }],
      orderSelectForm: {
        remark: '', // 订单备注
        orderNumber: '', // 订单编号
        createUser: '', // 录入人员
        createDate: '', // 录入时间
        orderSource: '', // 订单来源
        organizationName: '', // 机构名称
        memberUserId: '',
        memberUserName: '',
        memberUser: '',
        freightNumber: '', // 货运单号
        shipmentsDate: '', // 发货时间
        extractType: '', // 提货方式
        extractTypeName: '', // 提货方式名称
        extractDate: '',
        extractTime: '',
        sendType: '', // 送货类型
        sendTypeName: '', // 送货类型名称
        orderPrice: '', // 订单总金额
        sendTime: '',
        shipmentsAddressId: '', // 发货地址
        shipmentsProvince: '', // 发货-省
        shipmentsProvinceId: '', // 发货-省id
        shipmentsCity: '', // 发货-市
        shipmentsCityId: '', // 发货-市id
        shipmentsCounty: '', // 发货-县
        shipmentsCountyId: '', // 发货-县id
        shipmentsContactName: '',
        shipmentsContactPhone: '',
        shipmentsTelephone: '',
        shipmentsAddress: '',
        shipmentsStreet: '',
        sendAddressId: '', // 收货地址
        sendProvince: '', // 收货-省
        sendProvinceId: '', // 收货-省id
        sendCity: '', // 收货-市
        sendCityId: '', // 收货-市id
        sendCounty: '', // 收货-县
        sendCountyId: '', // 收货-县id
        sendContactName: '',
        sendContactPhone: '',
        sendTelephone: '',
        sendAddress: '',
        sendStreet: '',
        orderCargos: [], // 货物信息
        addValues: [], // 增值服务
        paymentType: '', // 付款方式
        orderStatus: '', // 订单状态
        agingModel: {}, // 时效方式model
        agingId: '', // 时效方式
        agingName: '', // 时效方式名称
        orderCostDetails: [], // 订单费用明细
        invoiceAddress: '', // 发票地址
        invoiceAddressModel: '', // 发票地址id
        invoiceAddressProvince: '', // 发票省
        invoiceAddressProvinceId: '', // 发票省id
        invoiceAddressCity: '', // 发票市
        invoiceAddressCityId: '', // 发票市id
        invoiceAddressCounty: '', // 发票县
        invoiceAddressCountyId: '', // 发票县id
        invoiceAddressStreet: '', // 发票地址街道
        valueMessageq: '', // 发票抬头101002005
        startNetWorkName: '',
        startNetWorkAddressNames: '',
        endNetWorkName: '',
        endNetWorkAddressNames: '',
        excellentRouteId: '', // 精品路线id
        excellentRouteNames: '' //  精品路线承诺服务名称s
      },
      noticeDelivery: false, // 等通知放货
      TXtitle: '',
      duthf: '', // 短途提货费
      bjyf: '', // 保价运费
      gxyf: '', // 干线运费
      dshkf: '', // 代收货款费
      dtshf: '', // 短途送货费
      yjf: '', // 月结费
      hdf: '', // 回单费
      xxf: '', // 信息费
      fpf: '' // 发票费
    };
  },
  props: {
    title: {}
  },
  watch: {
    title (val) {
      this.noticeDelivery = false;
      this.getOrder(val);
    }
  },
  methods: {
    searchTaxsheetTitle (val) {
      let filters = 'EQ_id=' + val;
      searchInvoiceManageByFilters({
        filters: filters,
        sorts: '-createDate',
        size: '15',
        page: '1'
      }).then((res) => {
        let models = res.data.detailModelList;
        this.TXtitle = models[0].taxsheetTitle;
      });
    },
    showOrderCostDetail () {
      this.duthf = 0;
      this.bjyf = 0;
      this.gxyf = 0;
      this.dshkf = 0;
      this.dtshf = 0;
      this.yjf = 0;
      this.hdf = 0;
      this.xxf = 0;
      this.fpf = 0;
      let msg = '';
      let gxf = 0;
      for (let odp in this.orderSelectForm.orderCostDetails) {
        let os = this.orderSelectForm.orderCostDetails[odp];
        let pe = Math.round(os.costPrice * 100) / 100;
        if (os.costCode === 101005001) {
          this.duthf = pe; // 短途提货费
        }
        if (os.costCode === 101005005) {
          this.bjyf = pe; // 保价运费
        }
        if (os.costCode === 101005002) {
          if (this.orderSelectForm.agingDictEntityId !== 112006003) {
            gxf = pe;
            pe = pe + '  (原价 ¥ ' + Math.round((os.costPrice + this.orderSelectForm.preferentialLine + this.orderSelectForm.advanceOrder) * 100) / 100 + '提前下单优惠' + this.orderSelectForm.advanceOrder + '元，线路优惠' + this.orderSelectForm.preferentialLine + '元)';
            msg = '  (原价 ¥ ' + Math.round((os.costPrice + this.orderSelectForm.preferentialLine + this.orderSelectForm.advanceOrder) * 100) / 100 + '提前下单优惠' + this.orderSelectForm.advanceOrder + '元，线路优惠' + this.orderSelectForm.preferentialLine + '元)';
          }
          this.gxyf = pe; // 干线运费
        }
        if (os.costCode === 101005006) {
          this.dshkf = pe; // 代收货款费
        }
        if (os.costCode === 101005003) {
          this.dtshf = pe; // 短途送货费
        }
        if (os.costCode === 101005004) {
          this.yjf = pe; // 月结费
          this.gxyf = (Math.round((pe) * 100) / 100) + msg;
        }
        if (os.costCode === 101005007 || os.costCode === 101005008) {
          this.hdf = pe; // 回单费
        }
        if (os.costCode === 101005014) {
          this.xxf = pe; // 信息费
        }
        if (os.costCode === 101005009 || os.costCode === 101005010 || os.costCode === 101005011) {
          this.fpf = pe; // 发票费
        }
      }
      console.log(gxf);
    },
    getOrder (val) {
      this.addBJ = true;
      this.addDS = true;
      this.addHD = true;
      this.addFP = true;
      getOrder(this.token, val.id).then((res) => {
        if (res.data.successFlg) {
          console.log(res);
          this.orderSelectForm = res.data.obj;
          for (let addValue in res.data.obj.addValues) {
            let dictValue = res.data.obj.addValues[addValue];
            if (dictValue.dictValue === 101002001) {
              this.addBJ = false;
              this.addBJValue = dictValue.value;
            } else if (dictValue.dictValue === 101002002) {
              this.addDS = false;
              this.addDSValue = dictValue.value;
            } else if (dictValue.dictValue === 101002003 || dictValue.dictValue === 101002004) {
              this.addHD = false;
            } else if (dictValue.dictValue === 101002005 || dictValue.dictValue === 101002006 || dictValue.dictValue === 101002007) {
              this.addFP = false;
              this.searchTaxsheetTitle(dictValue.taxsheetTitleId);
            } else if (dictValue.dictValue === 101002009) {
              this.noticeDelivery = true;
            }
          }
          this.orderSelectForm.orderCostDetails = res.data.obj.orderCostDetails;
          this.showOrderCostDetail();
        }
      });
    }
  },

  mounted () {
    this.getOrder(this.title);
  }

};
</script>
